using System;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;

namespace RBAC.Domain.Approval
{
    /// <summary>
    /// 审批实例实体
    /// </summary>
    [Table("ApprovalInstance")]
    public class ApprovalInstance : BaseEntity
    {
        /// <summary>
        /// 流程ID
        /// </summary>
        [Required]
        public long ProcessId { get; set; }

        /// <summary>
        /// 业务单据ID
        /// </summary>
        [Required]
        public long BusinessId { get; set; }

        /// <summary>
        /// 业务单据类型
        /// </summary>
        [Required]
        [StringLength(50)]
        public string BusinessType { get; set; } = string.Empty;

        /// <summary>
        /// 当前节点ID
        /// </summary>
        public long? CurrentNodeId { get; set; }

        /// <summary>
        /// 审批状态 (0:待审批 1:审批中 2:已通过 3:已拒绝)
        /// </summary>
        [Required]
        public int Status { get; set; } = 0;

        /// <summary>
        /// 申请人ID
        /// </summary>
        [Required]
        public long ApplicantId { get; set; }

        /// <summary>
        /// 申请人姓名
        /// </summary>
        [Required]
        [StringLength(50)]
        public string ApplicantName { get; set; } = string.Empty;

        /// <summary>
        /// 审批完成时间
        /// </summary>
        public DateTime? CompletedTime { get; set; }

        /// <summary>
        /// 所属审批流程
        /// </summary>
        public virtual ApprovalProcess ApprovalProcess { get; set; }

        /// <summary>
        /// 当前审批节点
        /// </summary>
        public virtual ApprovalNode CurrentNode { get; set; }
    }
}
